using MicroMsg.Manager;
using MicroMsg.UI.UserContrl;
using System;
using System.Data.Linq;
using System.Data.Linq.Mapping;
namespace MicroMsg.Storage
{
	[Table]
	public class QFriend : StorageItem, IListDataItem, BaseDataType
	{
		[Column(IsPrimaryKey = true)]
		public uint nQQ;
		[Column]
		public string strUsrName;
		[Column]
		public string strNickName;
		[Column]
		public string strQQNickName;
		[Column]
		public uint nWeixinStatus;
		[Column]
		public string strQQRemarkName;
		[Column]
		public string strPYInitial;
		[Column]
		public string strQuanPin;
		[Column]
		public string strQQPYInitial;
		[Column]
		public string strQQQuanPin;
		[Column]
		public string strQQRemarkPYInitial;
		[Column]
		public string strQQRemarkQuanPin;
		[Column]
		public int nSex;
		[Column]
		public string strProvince;
		[Column]
		public string strCity;
		[Column]
		public string strSignature;
		[Column]
		public int nPersonalCard;
		[Column]
		public int nGroupID;
		[Column(CanBeNull = true)]
		public string strAlias;
		[Column(IsVersion = true)]
		private Binary _version;
		[Column(DbType = "Image")]
		public byte[] bytesXmlBuf;
		private QFriendXmlData _xmlData;
		public uint nSnsFlag
		{
			get
			{
				this.load();
				return this._xmlData.nSnsFlag;
			}
			set
			{
				this.load();
				this._xmlData.nSnsFlag = value;
				this.unload();
			}
		}
		public string strSnsBGImgID
		{
			get
			{
				this.load();
				return this._xmlData.strSnsBGImgID;
			}
			set
			{
				this.load();
				this._xmlData.strSnsBGImgID = value;
				this.unload();
			}
		}
		public ulong nSnsBGObjectID
		{
			get
			{
				this.load();
				return this._xmlData.nSnsBGObjectID;
			}
			set
			{
				this.load();
				this._xmlData.nSnsBGObjectID = value;
				this.unload();
			}
		}
		public void LoadLazyData()
		{
			HeadImgMgr.getHeadImage(this);
		}
		public void FillData(object item)
		{
			QFriend qFriend = item as QFriend;
			if (qFriend == null)
			{
				return;
			}
			qFriend.nGroupID = this.nGroupID;
			qFriend.nPersonalCard = this.nPersonalCard;
			qFriend.nQQ = this.nQQ;
			qFriend.nSex = this.nSex;
			qFriend.nWeixinStatus = this.nWeixinStatus;
			qFriend.strCity = this.strCity;
			qFriend.strNickName = this.strNickName;
			qFriend.strProvince = this.strProvince;
			qFriend.strPYInitial = this.strPYInitial;
			qFriend.strQQNickName = this.strQQNickName;
			qFriend.strQQPYInitial = this.strQQPYInitial;
			qFriend.strQQQuanPin = this.strQQQuanPin;
			qFriend.strQQRemarkName = this.strQQRemarkName;
			qFriend.strQQRemarkPYInitial = this.strQQRemarkPYInitial;
			qFriend.strQQRemarkQuanPin = this.strQQRemarkQuanPin;
			qFriend.strQuanPin = this.strQuanPin;
			qFriend.strSignature = this.strSignature;
			qFriend.strUsrName = this.strUsrName;
		}
		private void load()
		{
			if (this._xmlData != null)
			{
				return;
			}
			this._xmlData = StorageXml.loadFromBuffer<QFriendXmlData>(this.bytesXmlBuf);
			if (this._xmlData == null)
			{
				this._xmlData = new QFriendXmlData();
			}
		}
		private void unload()
		{
			this.bytesXmlBuf = StorageXml.saveToBuffer<QFriendXmlData>(this._xmlData);
		}
	}
}
